//
// Created by RandBII on 2020/12/24.
//

#ifndef FFMPEGFORANDROID_IMAGEDEFINE_H
#define FFMPEGFORANDROID_IMAGEDEFINE_H

#include <string.h>
#include <malloc.h>
#include <unistd.h>
#include <stdio.h>
#include <stdint.h>
#include <sys/stat.h>
#include "LogUil.h"

#define IMAGE_FORMAT_RGBA 0X01
#define IMAGE_FORMAT_NV21 0X02
#define IMAGE_FORMAT_NV12 0X03
#define IMAGE_FORMAT_I420 0X04

#define IMAGE_FORMAT_RGBA_EXT "RGB32"
#define IMAGE_FORMAT_NV21_EXT "NV21"
#define IMAGE_FORMAT_NV12_EXT "NV12"
#define IMAGE_FORMAT_I420_EXT "I420"

// 矩形结构体
typedef struct _tag_NativeRectF {
    float left;
    float top;
    float right;
    float bottom;

    _tag_NativeRectF() {
        left = right = top = bottom = 0.0f;
    }

} RectF;

// 本地图片结构体
typedef struct _tag_NativeImage {
    int width;
    int height;
    int format;
    uint8_t *ppPlane[3];
    int pLineSize[3];

    _tag_NativeImage() {
        width = 0;
        height = 0;
        format = 0;
        ppPlane[0] = nullptr;
        ppPlane[1] = nullptr;
        ppPlane[2] = nullptr;

        pLineSize[0] = 0;
        pLineSize[1] = 0;
        pLineSize[2] = 0;
    };

} NativeImage;

class NativeImageUtil {

public:
    static void AllocNativeImage(NativeImage *pNativeImage);

    static void FreeNativeImage(NativeImage *pNativeImage);

    static void CopyNativeImage(NativeImage *pSrcImg, NativeImage *pDstImg);


};


#endif //FFMPEGFORANDROID_IMAGEDEFINE_H
